package com.crdeng.response;

/**
 * 定义返回码
 */
public enum ResultCode implements CustomizeResuleCode {
    /* 成功 */
    SUCCESS(200, "成功"),

    /* 默认失败 */
    COMMON_FAIL(999, "失败"),

    /* 参数错误：1000～1999 */
    PARAM_NOT_VALID(1001, "参数无效"),
    PARAM_IS_BLANK(1002, "参数为空"),
    PARAM_TYPE_ERROR(1003, "参数类型错误"),
    PARAM_NOT_COMPLETE(1004, "参数缺失"),

    /* 用户错误 */
    USER_NOT_LOGIN(2001, "用户未登录"),
    USER_ACCOUNT_EXPIRED(2002, "账号已过期"),
    USER_CREDENTIALS_ERROR(2003, "密码错误"),
    USER_CREDENTIALS_EXPIRED(2004, "密码过期"),
    USER_ACCOUNT_DISABLE(2005, "账号不可用"),
    USER_ACCOUNT_LOCKED(2006, "账号被锁定"),
    USER_ACCOUNT_NOT_EXIST(2007, "账号不存在"),
    USER_ACCOUNT_ALREADY_EXIST(2008, "账号已存在"),
    USER_ACCOUNT_USE_BY_OTHERS(2009, "账号下线"),
    USER_ACCOUNT_NOT_NEW_DELETE(2010, "不能删除当前登入用户"),

    /*部门错误*/
    DEPARTMENT_NOT_EXIST(3007, "部门不存在"),
    DEPARTMENT_ALREADY_EXIST(3008, "部门已存在"),

    /*角色错误*/
    ROLE_NOT_EXIST(4007, "角色不存在"),
    ROLE_ALREADY_EXIST(4008, "角色已存在"),

    /*菜单错误*/
    MENU_NOT_EXIST(5001, "菜单不存在"),
    MENU_ALREADY_EXIST(5002, "菜单已存在"),
    MENU_ADD_FAIL(5003,"菜单添加失败"),
    MENU_EDIT_FAIL(5003,"菜单修改失败"),

    /* 业务错误 */
    NO_PERMISSION(3001, "没有权限"),

    /*商品分类错误*/
    CATEGORY_NOT_EXIST(3100,"分类不存在"),
    CATEGORY_EXIST_CHILD_NODE(3101,"分类存在子节点,无法直接删除"),
    CATEGORY_EXIST_RELATION(3102,"分类存在商品联系,无法直接删除"),
    CATEGORY_ALREADY_EXIST(3103,"分类已经存在,无法添加"),

    /*商品资料错误*/
    PRODYCT_NOT_EXIST(3200,"商品资料不存在"),

    /*运行时异常*/
    ARITHMETIC_EXCEPTION(9001, "算数异常");

    private Integer code;

    private String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
